home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d3
/
amac36.arc
/
SRCH_Q.QM
< prev
next >
Wrap
Text File
|
1991-03-16
|
5KB
|
94 lines
* --------------------------------------------------------------------
* @(4) Search/replace from command line, quit each file after rplcmnt.
* --------------------------------------------------------------------
*
* Often the total size of files needing a "replacement" will exceed the
* available memory when using SR.BAT and the startup macro @0. Macro @4
* in SRCH_Q.QM is simply a modification of @0 by replacing savefile with
* file, so each file is quit after replacement.
*
* This macro must be the first macro in the file because it is used as
* the startup macro with SRQ.BAT. It cannot be run from command line!
*
@4 MacroBegin
***************************************** LOAD FILES
Altwordset * For all file names
Endfile * Get to end of file
LOADAGAIN: *
Unmarkblock * Unmark last file name
Find #42 "Fi" Return "B" Return* Find file name
Jfalse END: * No find ? quit
Wordright * Move to space
Wordright * Move to file name
Markcolumn * Mark it
Endline * Get all name in block
Copy * Copy file name to scrap
EditFile * Get ready to load
CurrentFilename " " * To force return *here*
Paste Return * Paste file name & do it!
Cursorup * Go to next line
Jfalse ENDLOAD: * No more filenames? Done load
Jump LOADAGAIN: * Check again
ENDLOAD: *
Quit * Quit c:! from ring so no rplc
***************************************** GET SEARCH TEXT TO SCRATCH
Editfile "C:$" Return * Load set output file
Find "FGS" Return Return * Find FGS
Wordright * Get to SEARCH text
Markcolumn * Begin mark
Endline * Mark SEARCH text
Cursorleft * No trailing space in block
Storescrbuff "FGS" Return * Store SEARCH text to scratch
***************************************** GET REPLACE TEXT TO SCRATCH
Unmarkblock * Get ready
Begfile * Get to top
Find "FGR" Return Return * Find FGR
Wordright * Get to REPLACE text
Markcolumn * Begin mark
Endline * Mark it all
Cursorleft * No trailing space in block
Storescrbuff "FGR" Return * Store REPLACE text to scratch
Killfile * Kill c:$ for next time
Quit * Remove c:$ from ring
***************************************** BEGIN SEARCH/REPLACE
Editfile "_" Return * Insert -or- GoTo NUL File
Getscrbuff "FGS" Return Cut * Cut search text from scratch
Find Paste Return Escape * Initialize find prompt
Getscrbuff "FGR" Return Cut * Cut replace text from scratch
FindReplace Return * Begin replacement
Paste Return * paste REPLACEMENT text
** "GIN" Return ** Replace, no prompt
Pause Return * Allow user input of Options
Begline Cursorright * Put cursor in Col. 2 of NUL File
LOOP: * Main test loop
Nextfile * Move to next files in Ring
Cursorleft * Move cursor left (need for NUL test)
Jfalse DOIT: * If couldn't move to left, it's not
* the NUL File AND cursor position
* has not changed -- GO with the
* FindReplace
*ELSE
* Check to see if in the NUL File
Cursorleft * Move cursor left for NUL Test
Jfalse ENDLOOP: * If couldn't move left -- We
* ARE in the NUL File and Need
* to ENDLOOP
*ELSE
Cursorright * Move back to Col. 2 in NUL File
DOIT: * FindReplace Loop
BegFile * Move up in case cursor is below find
Repeatfind * Do the FindReplace
Jtrue SAVE: * If CHANGES are made -- SAVE the File
Quit * If NO CHANGES are made -- QUIT the
* File
Jump LOOP: * Return to the Main Loop
SAVE: * Routine to Save a File with Changes
File * Save and quit this file after rplcmnt
Jump LOOP: * Return to Main Loop
ENDLOOP: * Loop is DONE
Quit * Quit the NUL File
END: *
Defaultwordset * set default
*
* 153 bytes Thu 03-07-1991 16:54:06